//++
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
// Module Name:
//
//  NotificationCustomChannel.cs
//    
// Abstract:
//
//  Represents a user-defined notification channel.
//  
//--

using System;

namespace Microsoft.EnhancedReminders
{
    /// <summary>
    /// Represents a custom (i.e. details not stored in OCS) notification channel.
    /// </summary>
    [Serializable()]
    public class NotificationCustomChannel : NotificationChannel
    {
        private NotificationChannelType _notificationChannelType;

        /// <summary>
        /// ctor.
        /// </summary>
        public NotificationCustomChannel()
        {
            _id = Guid.NewGuid();
        }

        /// <summary>
        /// Ctor.
        /// </summary>
        /// <param name="channelType">Type of channel</param>
        /// <param name="channelName">A name for the channel</param>
        /// <param name="channelValue">The address of the channel</param>
        public NotificationCustomChannel(NotificationChannelType channelType, string channelName, string channelValue)
            : base(Guid.NewGuid(), channelName, channelValue)
        {
            _notificationChannelType = channelType;
        }

        /// <summary>
        /// Copy ctor.  Used by Copy() to create a NotificationCustomChannel clone.
        /// </summary>
        /// <param name="channel">The NotificationCustomChannel instance to take a copy of.</param>
        protected NotificationCustomChannel(NotificationCustomChannel channel)
            : base(channel)
        {
            _notificationChannelType = channel._notificationChannelType;
        }

        /// <summary>
        /// Creates a copy of a NotificationCustomChannel instance.
        /// </summary>
        /// <returns></returns>
        public override NotificationChannel Copy()
        {
            return new NotificationCustomChannel(this);
        }

        /// <summary>
        /// Type of channel.
        /// </summary>
        public override NotificationChannelType NotificationChannelType
        {
            get
            {
                return _notificationChannelType;
            }
            set
            {
                _notificationChannelType = value;
            }
        }
    }
}
